package com.xinsoft.entity.dto;

import cn.hutool.core.util.ObjectUtil;
import com.xinsoft.entity.po.SysClient;
import com.xinsoft.utils.TokenUtil;
import lombok.Data;

/**
 *  @author: π
 *  客户
 */
@Data
public class KisClientDto {

    private String FItemId;
    private String FNumber;
    private String FName;
//    private String FHelpCode;
    private String FShortName;
    private String FAddress;
    private String FStatus;
    private String FStatus_FName;
    private String FRegionID_FName;
    private String FRegionID;
    private String FTrade;
    private String FTrade_FName;
    private String FContact;
    private String FPhone;
    private String FMobilePhone;
    private String FPostalCode;
    private String FEmail;
    private String FBank;
    private String FAccount;
    private String Fcorperate;
    private String FTypeID;
    private String FTypeID_FName;

//    kis字段 ：
//            "FItemId":"内码"
//            "FNumber":"编码"
//            "FName":"名称"
//            "FHelpCode":"助记码"
//            "FShortName":"简称"
//            "FAddress":"地址"
//            "FStatus":"状态"
//            "FStatus_FName":"状态"
//            "FRegionID_FName":"区域"
//            "FRegionID":"区域"
//            "FTrade":"行业"
//            "FTrade_FName":"行业"
//            "FContact":"联系人"
//            "FPhone":"电话"
//            "FMobilePhone":"移动电话"
//            "FPostalCode":"邮编"
//            "FEmail":"邮件地址"
//            "FBank":"开户银行"
//            "FAccount":"银行账号"
//            "Fcorperate":"法人代表"
//            "FTypeID":"客户分类"
//            "FTypeID_FName":"客户分类"


//    {
//        "FRECORDS": 1,
//            "FItemId": 11865,
//            "FNumber": "C092",
//            "FName": "千思跃智能科技（苏州）股份有限公司",
//            "FParentId": 0,
//            "FHelpCode": "QSYZNKJ（SZ）GFYXGS",
//            "FShortName": null,
//            "FAddress": "江苏省无苏州市吴江经济技术开发区江兴东路49号1号厂房2楼",
//            "FStatus": 1072,
//            "FStatus_FName": "使用",
//            "FRegionID": 0,
//            "FRegionID_FName": null,
//            "FTrade": 0,
//            "FTrade_FName": null,
//            "FContact": null,
//            "FPhone": null,
//            "FMobilePhone": null,
//            "FPostalCode": null,
//            "FEmail": null,
//            "FBank": null,
//            "FAccount": null,
//            "Fcorperate": null,
//            "FTypeID": 0,
//            "FTypeID_FName": null
//    }
public static SysClient voToPo(KisClientDto vo) {
    if (vo == null) {
        return null;
    }
    SysClient sysClient = new SysClient();
    sysClient.setId(new Integer(vo.getFItemId()));
    sysClient.setClientCode(vo.getFNumber());
    sysClient.setClientName(vo.getFName());
    sysClient.setPhone(vo.getFPhone());
    sysClient.setAddress(vo.getFAddress());
    sysClient.setBank(vo.getFBank());
    // sysClient.setBelongUserId(ObjectUtil.isEmpty(vo.getFContact()) ? null : new Integer(vo.getFContact()));
    sysClient.setAccount(vo.getFAccount());
    sysClient.setClientStatus(1);
    sysClient.setDoCredit(0);
    sysClient.setAuditStatus(1);
    sysClient.setAuditId(TokenUtil.getUserId());
    return sysClient;
}
}
